<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <div
      class="boardleft"
      :style="{
        backgroundImage: `url(${publicUrls + 'free/style4/exhibitionStandStyle5BgLeft.webp'})`,
      }"
    >
      <img class="left-img" :src="publicUrls + 'free/style4/exhibitionStandStyle5Img.png'" alt="" />
    </div>
    <div
      @contextmenu.stop="emit('onContextMenuChild', $event, index)"
      v-for="(item, index) in props.info.showpieceList"
      :key="index"
      class="item-parent"
    >
      <div class="cover-box" @click="viewImg(item.moduleId, item.id)">
        <img class="cover-img" :src="getLinkUrl(item.coverUrl,'?imageView2/3/w/600/format/webp')" alt="" />
        <!-- <img v-if="route.meta.loopType" class="flower-btn" :src="publicUrls + 'free/style4/flower.png'" /> -->
      </div>
      <div class="item-name">
        <p>{{ item.name }}</p>
      </div>
    </div>
    <div
      class="boardleft"
      :style="{
        backgroundImage: `url(${publicUrls + 'free/style4/exhibitionStandStyle5BgRight.webp'})`,
      }"
    ></div>
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'free4Style5',
});
</script>
<script lang="ts" setup>
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick, defineComponent } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';
import { useRoute } from 'vue-router';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const route = useRoute();
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
// watch(
//   () => props.info.width,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );
// watch(
//   () => props.info.height,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );

//
</script>

<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 999;
  padding-bottom: 2px !important;
  -webkit-box-reflect: below 0% linear-gradient(transparent, rgba(0, 0, 0, 0.15));
}
.boardleft {
  width: 94px;
  height: 674px;
  flex-shrink: 0;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  position: relative;
}
.left-img {
  width: 122px;
  height: 207px;
  object-fit: cover;
  position: absolute;
  left: 0;
  bottom: 25px;
}
.item-parent {
  width: 229px;
  height: 674px;
  flex-shrink: 0;
  background: url('https://static.jiyi.show/free/style4/exhibitionStandStyle5Bg.webp') no-repeat center/100% 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cover-box {
  width: 209px;
  height: 427px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  margin-top: 6px;
  .cover-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all 0.5s;
  }
  &:hover {
    .cover-img {
      transform: scale(1.2);
    }
  }
}
.flower-btn {
  width: 50px;
  height: 50px;
  object-fit: cover;
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -40%);
  animation: flower 2s linear infinite;
  @keyframes flower {
    0% {
      opacity: 0;
    }
    40% {
      opacity: 100%;
    }
    60% {
      opacity: 100%;
    }
    100% {
      opacity: 0;
    }
  }
}
.item-name {
  position: relative;
  z-index: 9;
  flex-shrink: 0;
  width: 218px;
  height: 48px;
  background: url('https://static.jiyi.show/free/style4/exhibitsNameBg.webp') no-repeat center/100% 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 28px;
  p {
    width: 168px;
    color: #fcffff;
    text-align: center;
    font-family: 'PingFang SC';
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: 32px; /* 200% */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
</style>
